﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DreamBuilder.Common;
using ePlanet.ArchiveMange.Services;
using ePlanet.ArchiveMange.DataAccess;
using ePlanet.ArchiveMange.Models;

namespace ePlanet.ArchiveMange.Business
{
    public class BUSDocumentArchiveVol:BusinessBase,IDocumentArchiveVolService
    {
        DocumentArchiveVolDAL dal = new DocumentArchiveVolDAL();
        ArchiveCommon commonDal = new ArchiveCommon();
        #region IDocumentArchiveVolService 成员

        /// <summary>
        /// 获取文书卷信息列表
        /// </summary>
        /// <returns></returns>
        public Models.ArchiveMangeModal.DOCUMENT_ARCHIVE_VOLDataTable GetAllDocumenArchivetData()
        {
            return dal.GetAllDocumenArchivetData();
        }

        /// <summary>
        /// 根据档案主键获取文书卷信息
        /// </summary>
        /// <param name="DATAID"></param>
        /// <returns></returns>
        public Models.ArchiveMangeModal.DOCUMENT_ARCHIVE_VOLDataTable GetAllDocumenArchivetDataById(string DATAID)
        {
            return dal.GetAllDocumenArchivetDataById(DATAID);
        }

        /// <summary>
        /// 根据过滤条件查询数据
        /// </summary>
        /// <param name="filter">查询条件字符串</param>
        /// <returns></returns>
        public ArchiveMangeModal.DOCUMENT_ARCHIVE_VOLDataTable GetAllDocumenArchivetByFilter(string filter)
        {
            return dal.GetAllDocumenArchivetByFilter(filter);
        }

        /// <summary>
        /// 根据档案ID列表获取文书卷信息列表
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        public System.Data.DataTable GetDocumentArchiveDataByIds(IEnumerable<string> idList)
        {
            return dal.GetDocumentArchiveDataByIds(idList);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        public System.Data.DataTable GetHandoverDataByIds(IEnumerable<string> idList)
        {
            return dal.GetHandoverDataByIds(idList);
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="idList"></param>
        /// <returns></returns>
        public System.Data.DataTable GetArchiveDateSpanByIds(IEnumerable<string> idList)
        {
            return dal.GetArchiveDateSpanByIds(idList);
        }

        /// <summary>
        /// 根据档案类型获取文书卷信息
        /// </summary>
        /// <param name="archiveType"></param>
        /// <returns></returns>
        public Models.ArchiveMangeModal.DOCUMENT_ARCHIVE_VOLDataTable GetArchiveByType(string archiveType)
        {
            return dal.GetArchiveByType(archiveType);
        }

        /// <summary>
        /// 根据档案类型和用户ID获取文书卷信息
        /// </summary>
        /// <param name="archiveType"></param>
        /// <param name="userId"></param>
        /// <returns></returns>
        public Models.ArchiveMangeModal.DOCUMENT_ARCHIVE_VOLDataTable GetTypeArchiveByUserId(string archiveType, string userId)
        {
            return dal.GetTypeArchiveByUserId(archiveType, userId);
        }

        #endregion

        #region IArchiveBase 成员

        /// <summary>
        /// 保存文书卷数据
        /// </summary>
        /// <param name="ds"></param>
        /// <returns></returns>
        public bool SaveData(System.Data.DataSet ds)
        {
           return commonDal.SaveData(ds);
        }

        /// <summary>
        /// 保存附件
        /// </summary>
        /// <param name="dt_Attach"></param>
        /// <param name="objectTableName"></param>
        /// <param name="objectID"></param>
        /// <param name="DBHelperString"></param>
        /// <returns></returns>
        public bool SaveAttach(System.Data.DataTable dt_Attach, string objectTableName, string objectID, string DBHelperString)
        {
            return commonDal.SaveAttach(dt_Attach, objectTableName, objectID, DBHelperString);
        }

        /// <summary>
        /// 根据附件ID和数据库连接字符串，获取附件内容
        /// </summary>
        /// <param name="dataID"></param>
        /// <param name="DBHelperString"></param>
        /// <returns></returns>
        public byte[] GetAttachContentByID(string dataID, string DBHelperString)
        {
            return commonDal.GetAttachContentByID(dataID, DBHelperString);
        }

        /// <summary>
        /// 根据文书卷主键和数据库连接，获取附件信息
        /// </summary>
        /// <param name="ObjectID"></param>
        /// <param name="DBHelperString"></param>
        /// <returns></returns>
        public System.Data.DataSet GetAttach(string ObjectID, string DBHelperString)
        {
            return commonDal.GetAttach(ObjectID, DBHelperString);
        }

        public bool IsSameSecret(List<Guid> dataIDList)
        {
            return dal.IsSameSecret(dataIDList);
        }

        /// <summary>
        /// 根据文书卷主键删除文书信息（由于历史数据不能删除，该接口未实现）
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public bool DeleteData(string key)
        {
            return dal.DeleteData(key);
        }

        #endregion
    }
}
